package com.example.lovedogs.fragment.shop;

import com.example.lovedogs.MainActivity;
import com.example.lovedogs.R;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

public class shangchengLeftFragment extends Fragment implements OnClickListener {
	private View view;
	private MainActivity activity;
	ShangchengRightFragment rightFragment;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
	if(view == null){
		view  = inflater.inflate(R.layout.fragmentleft_shangcheng, container, false);
		Button btn1 = (Button) view.findViewById(R.id.button1);
		Button btn2 = (Button) view.findViewById(R.id.button2);
		btn1.setOnClickListener(this);
		btn2.setOnClickListener(this);
	}
	activity=(MainActivity) getActivity();
	return view;
}

@Override
public void onClick(View v) {
	rightFragment = activity.getRigthFragment();
	String data;
	switch (v.getId()) {
	case R.id.button1:
		Toast.makeText(activity, "button01", 1).show();
		 data="button1";
		rightFragment.updateListViewRightFragment(data);
		break;
	case R.id.button2:
		 data="button2";
		rightFragment.updateListViewRightFragment(data);
		break;
	default:
		break;
	}
	
}
}

